package com.example.micro.netty.server.inbound_outbound;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * 把Initializer理解成pipeline
 */
public class MyCustomBoundServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline channelPipeline = ch.pipeline();

        //入站的handler进行解码 MyByteToLongDecoder
        channelPipeline.addLast(new MyLongToByteEncoder());

        channelPipeline.addLast(new MyCustomBoundServerHandler());

    }

}
